% Image Processing Homework #2
% Professor Mandelbaum
% Authors: B. Green and R. Stanciu
% DATE: 04/15/04
% FILE: imagePad.m
% DESC: Pad the image with a border of "0" pixels and display the image

function ourImage3=imagePad(ourImage, border, width, height)

%create a (2*border+width,2*border+height) matrix with zero elements
height3=height+2*border;
width3=width+2*border;
ourImage3=zeros(height3, width3);

%create bordered image
for r=1:height3
    for c=1:width3
        if ((r>border)&(r<(height3-border))&(c>border)&(c<=(width3-border)))
        ourImage3(r,c)=ourImage(r-border,c-border);
        end
    end
end

figure;
colormap(gray(256));
image(ourImage3)
title('the padded image');



